package com.rangter.MissedCalls.Pages;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;

public class MainPage extends Activity {

	private Button btnSignUp;
	private Button btnSignIn;
	private Button btnHelp;
	//private Button btnContactUs;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_page);

        findViews();
        setListeners();
    }
    
    private void findViews(){
    	btnSignUp = (Button)findViewById(R.id.btnSignUp);
    	btnSignIn = (Button)findViewById(R.id.btnSignIn);
    	btnHelp = (Button)findViewById(R.id.btnHelp);
    	//btnContactUs = (Button)findViewById(R.id.btnContactUs);
    }
    
    private void setListeners(){
    	btnSignUp.setOnClickListener(listenerSignUp);
    	btnSignIn.setOnClickListener(listenerSignIn);
    	btnHelp.setOnClickListener(listenerHelp);
    	//btnContactUs.setOnClickListener(listenerContactUs);
    }
    
    private View.OnClickListener listenerSignUp = new View.OnClickListener(){
    	//@Override
    	public void onClick(View v){
    		Intent i = new Intent(MainPage.this,Register.class);
    		startActivity(i);
    		MainPage.this.finish();
    	}
    };
    
    private View.OnClickListener listenerSignIn = new View.OnClickListener(){
    	//@Override
    	public void onClick(View v){
    		Intent i = new Intent(MainPage.this, animActivity.class);
    		startActivity(i);
    		MainPage.this.finish();
    	}
    };
    
    private View.OnClickListener listenerHelp = new View.OnClickListener(){

    	public void onClick(View v){
    		Intent i = new Intent(MainPage.this, Help.class);
    		startActivity(i);
    		MainPage.this.finish();
    	}
    };
    
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if(keyCode==KeyEvent.KEYCODE_BACK)
		{
			Intent MyIntent = new Intent(Intent.ACTION_MAIN);
			MyIntent.addCategory(Intent.CATEGORY_HOME);
			startActivity(MyIntent);
			return false;
		}
		return super.onKeyDown(keyCode, event);
		
	}
	
//	@Override
//	protected void onPause() {
//	      int nPid=android.os.Process.myPid();
//	      android.os.Process.killProcess(nPid);
//	}
}
